//
//  ViewController.m
//  IOS
//
//  Created by blue on 15-11-2.
//  Copyright (c) 2015年 zhangxin. All rights reserved.
//

#import "ViewController.h"
//#import "QuartzCore/QuartZCore.h"
#import "TestViewController.h"
#import "TTableViewController.h"
#import "Test2ViewController.h"
@interface ViewController ()
{
    UILabel * l;
}
@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    self.title = @"我的标题";
	// Do any additional setup after loading the view, typically from a nib.
    
    self.view.backgroundColor = [UIColor greenColor];
    

    l = [UILabel new];
    l.text = @"你好！";
    [l sizeToFit];
    l.center = CGPointMake(self.view.frame.size.width/2.0,self.view.frame.size.height/2.0);

   l = [[UILabel alloc]initWithFrame:CGRectMake(60, 210,100, 50)];
   l.text = @"你好！";

    l.textColor = [UIColor orangeColor];
    [self.view addSubview:l];
    
    
    for (int i=1; i<=5; i++) {
        UIView * a = [[UIView alloc]initWithFrame:CGRectMake(20+i*50+i*8,50, 25, 25)];
        a.backgroundColor =[UIColor greenColor];
        [self.view addSubview:a];
    
        }
  /*  UIView * line = [[UIView alloc]initWithFrame:CGRectMake(30, 100, 200, 3)];
    line.backgroundColor = [UIColor redColor];
    [self.view addSubview:line];
   */
    //田字
    /*for (int i=1; i<4; i++) {
        UIView * line1 = [[UIView alloc]initWithFrame:CGRectMake(50,i*50, 100, 2)];
        line1.backgroundColor = [UIColor redColor];
        [self.view addSubview:line1];
       for (int j=1; j<4; j++) {
            
           UIView * line2 = [[UIView alloc]initWithFrame:CGRectMake(j*50,50, 2, 100)];
           line2.backgroundColor = [UIColor redColor];
           [self.view addSubview:line2];
        }

    }*/
    
    UIView * view = [[UIView alloc]initWithFrame:CGRectMake(20,200, 200, 200)];
    view.layer.borderWidth=2;
    view.clipsToBounds=YES;
    [self.view addSubview:view];

    UIView * line2 = [[UIView alloc]initWithFrame:CGRectMake(99,0,200,200)];
    line2.layer.borderWidth=2;
    
    [view addSubview:line2];
    ;
    
    UIView * yuan =[[UIView alloc]initWithFrame:CGRectMake(100, 0, 200, 200)];
    yuan.layer.cornerRadius = 100;
    yuan.layer.borderWidth= 2;
    [view addSubview:yuan];
    
    UIView * line3 = [[UIView alloc]initWithFrame:CGRectMake(0,99,200,200)];
   line3.layer.borderWidth=2;
    [view addSubview:line3];
    
    UIButton * bth = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    bth.frame = CGRectMake(100, 100, 200, 44);
    [bth setTitle:@"按钮" forState:UIControlStateNormal];
    [bth setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    
    [bth addTarget:self action:@selector(onClick:) forControlEvents:UIControlEventTouchUpInside];
    
    [self.view addSubview:bth];
    
    
    
    UIButton * bth2 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    bth2.frame = CGRectMake(100, 120, 200, 44);
    [bth2 setTitle:@"🔘" forState:UIControlStateNormal];
    [bth2 setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    
    [bth2 addTarget:self action:@selector(onClick2:) forControlEvents:UIControlEventTouchUpInside];
    
    [self.view addSubview:bth2];

    
    
   

    }

//第一个按钮
- (void)onClick:(id)sender
{

    /*
        划线动画
    UIView * line = [[UIView alloc]initWithFrame:CGRectMake(0,200,0,3)];
    line.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:line];
    UIView * line2 = [[UIView alloc]initWithFrame:CGRectMake(self.view.frame.size.width/2.0, 0, 6, 0)];
    line2.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:line2];
    
    
        [UIView animateWithDuration:0.6 animations:^{
            line.frame = CGRectMake(0, 200, self.view.frame.size.width, 6);
        }completion:^(BOOL finish) {
            [UIView animateWithDuration:0.6 animations:^{
                line.frame = CGRectMake(self.view.frame.size.width,0,0,6);
                line2.frame = CGRectMake(self.view.frame.size.width/2.0 , 0 , 6 ,self.view.frame.size.height);
            }
        completion:^(BOOL finish) {
            [UIView animateWithDuration:0.6 animations:^{
                line2.frame =CGRectMake(self.view.frame.size.width/2.0 , self.view.frame.size.height , 0 ,6);
        }];
        }];
        }];
     */
    
   TTableViewController * con = [TTableViewController new];
    [self.navigationController pushViewController:con animated:YES];

    
    

}
//第二个按钮
- (void)onClick2:(UIButton *) sender
{
    Test2ViewController * con = [Test2ViewController new];
    [self.navigationController pushViewController:con animated:YES];
}


- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
